package com.example.testanimation.self;

import java.util.ArrayList;

import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.GridView;
import android.widget.TextView;

import com.scenic.rd_android.R;

public class HorizontalGridViewActivity extends Activity{

	@Override
	public View onCreateView(String name, Context context, AttributeSet attrs) {
		return super.onCreateView(name, context, attrs);
	}
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_gridview);
		GridView view = (GridView) findViewById(R.id.id_gridview);
		view.setAdapter(new MyApdater());
	}
	
	
	
	class MyApdater extends BaseAdapter {

		ArrayList<String> list = new ArrayList<String>();
		public MyApdater() {
			
			for(int i = 0;i < 1000; i++){
				list.add("ITEM " + i);
			}
		}
		
		@Override
		public int getCount() {
			return list.size();
		}

		@Override
		public Object getItem(int position) {
			return null;
		}

		@Override
		public long getItemId(int position) {
			return 0;
		}

		@Override
		public View getView(int position, View convertView, ViewGroup parent) {
			if(convertView == null){
				convertView = LayoutInflater.from(HorizontalGridViewActivity.this).inflate(R.layout.adapter_gridview, null);
			}
			
			TextView txView = (TextView) convertView.findViewById(R.id.id_txview_adapter);
			txView.setText(list.get(position));
			return convertView;
		}
		
	}
}
